Column

Chart A

# A tibble: 134 × 2
   aisle                      n
   <chr>                  <int>
 1 air fresheners candles  1067
 2 asian foods             7007
 3 baby accessories         306
 4 baby bath body care      328
 5 baby food formula      13198
 6 bakery desserts         1501
 7 baking ingredients     13088
 8 baking supplies decor   1094
 9 beauty                   287
10 beers coolers           1839
# … with 124 more rows

Column

Chart B

Chart C

---
title: "Dashboard"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
    source: embed
---

```{r, include=FALSE}
library(flexdashboard)
library(tidyverse)
library("p8105.datasets")
library(plotly)

data("instacart")
```


```{r}
# nyc_airbnb <- 
#   nyc_airbnb %>%
#   mutate(rating = review_scores_location / 2) %>%
#   select(neighbourhood_group, neighbourhood, rating, price, room_type, lat, long) %>%
#   filter(
#     neighbourhood_group == "Manhattan",
#     price %in% 100:500,
#     room_type == "Entire home/apt"
#   ) %>%
#   drop_na(rating)
# 
# instacart2 <-
#   instacart %>%
#   filter(department == "alcohol") %>%
#   group_by(product_name) %>%
#   summarize(n = n())
# 
# instacart %>% group_by(department) %>%
#   summarize(n = n())
# 
# instacart %>% count(aisle) %>% arrange(desc(n))
# 
# instacart2 <- 
#   instacart %>%
#   filter(department == "alcohol") %>%
#   #group_by(aisle) %>%
#   count(product_name) %>%
#   mutate(rank = min_rank(rank(desc(n)))) %>%
#   filter(rank <= 50) %>%
#   arrange(desc(n))
```

Column {data-width=500}
-----------------------------------------------------------------------

### Chart A

```{r}
instacart %>% 
  filter(department == "alcohol") %>%
  count(product_name, aisle) %>% 
  mutate(rank = min_rank(rank(desc(n)))) %>%
  filter(rank < 50) %>%
  mutate(product_name = fct_reorder(product_name, n)) %>% 
  plot_ly(x = ~product_name, y = ~n, color = ~aisle, type = "bar", colors = "Set2") %>%
  layout(title = "Top 50 Ordered Alcoholic Beverages",
         xaxis = list(title = "Name of Product"),
         yaxis = list(title = "Number Ordered"),
         legend = list(x = 0.1, y = 0.9))

instacart %>% count(aisle)
```

Column {data-width=500}
-----------------------------------------------------------------------

### Chart B

```{r}

```

### Chart C

```{r}

```